package follow.pratice.in2020.November.demo;

import java.util.concurrent.*;

public class Case_1 implements Callable<Integer> {
    public static void main(String[] args) throws ExecutionException, InterruptedException {


        //创建线程池
        ExecutorService service = Executors.newFixedThreadPool(10);

        //提交任务，并用future提交返回结果
        Future<Integer> future = service.submit(new Case_1());

        Integer integer = future.get();

        System.out.println(integer);
    }

    @Override
    public Integer call() throws Exception {
        System.out.println(Thread.currentThread().getName());
        return 1;
    }
}
